[#macro streamListView]
<div>
    <div class="data-content1">
        <el-table v-loading="loading" :data="tableData.list"  @sort-change="changeTableSort"
            style="width: 100%;font-size: 12px;">
            <el-table-column label="流水号"  sortable="custom" prop="no" width="100">
            </el-table-column>
            <el-table-column label="交易前余额"  sortable="custom" prop="preAmount" width="120">
            </el-table-column>
            <el-table-column label="交易金额"  sortable="custom" prop="money" width="120">
            </el-table-column>
            <el-table-column label="交易后余额"  sortable="custom" prop="afterAmount" width="120">
            </el-table-column>
            <el-table-column label="账号名称" prop="accountName" width="120">
            </el-table-column>
            <el-table-column label="创建时间"  sortable="custom" prop="date" width="160" >
            </el-table-column>
            <el-table-column label="备注" prop="note" >
            </el-table-column>
        </el-table>

        <div class="page">
            <el-pagination background :current-page="searchObject.no" :page-sizes="[10, 20, 50, 100]"
                :page-size="tableData.size" :pager-count="5" layout="total, sizes, prev, pager, next, jumper"
                :page-count="tableData.totalPage" :total="tableData.total" @size-change="sizeChange"
                @current-change="pageChange">
            </el-pagination>
        </div>
    </div>
</div>
[/#macro]
[#macro streamListConfig]
<script type="text/x-template" id="my-stream-list">
	[@streamListView /]
</script>
<script type="text/javascript">
    var streamListConfig = {};
    streamListConfig.template = "#my-stream-list";
    streamListConfig.methods = config.basicMethod();


    streamListConfig.methods.addView = function () {
        this.$router.push({ path: 'add' });
    }
    streamListConfig.methods.auditView = function (row) {
        this.selectData = row;
        this.auditVisible = true;
        this.form.name = row.name;
        this.form.logo = row.logo;
        this.form.id = row.id;

        this.form.auditState="";
    }


    streamListConfig.methods.editView = function (row) {
        var self = this;
        var data = {};
        data.id = row.id;
        this.$router.push({ path: 'update', query: data });

    }

    streamListConfig.methods.changeTableSort = function (column) {
        this.searchObject.sortField = column.prop;
        if ("descending" == column.order) {
            this.searchObject.sortMethod = "desc";
        }
        else if ("ascending" == column.order) {
            this.searchObject.sortMethod = "asc";
        }
        else {
            this.searchObject.sortMethod = "";
        }
        this.getSearchList();
    }
    streamListConfig.methods.showView = function (row, column, cell, event) {
        if (cell.cellIndex >= 0) {
            return;
        }
        var param = {};
        param.id = row.id;
        var self = this;
        this.$router.push({ path: 'view', query: param });

    }
    streamListConfig.methods.show = function (row) {
        var param = {};
        param.id = row.id;
        var self = this;
        this.$router.push({ path: 'view', query: param });

    }

    streamListConfig.methods.handleSelect = function (index) {
        if (index == "1") {
            this.searchObject.auditState = "checked"
        } else if (index == "2") {
            this.searchObject.auditState = "wait"
        } else if (index == "3") {
            this.searchObject.auditState = "fail"
        } else {
            this.searchObject.auditState = ""
        }
        this.activeIndex = index;
        this.getSearchList();
    }

    streamListConfig.methods.sizeChange = function (event) {
        this.searchObject.size = event;
        this.getSearchList();
    }
    streamListConfig.methods.pageChange = function (index) {
        this.searchObject.no = index;
        this.getSearchList();
    }
    streamListConfig.methods.getSearchList = function () {
        this.loading = true;
        var data = this.searchObject, that = this;
        $.post("${siteurl}tenantRest/sitetenant/stream.htm", data, function (result) {
            if (result.code == 0) {
                that.tableData = result;
            }
            setTimeout(function () {
                that.loading = false;
            }, 300)
        });
    }
    streamListConfig.methods.search = function () {
        this.searchObject.no = 1;
        this.getSearchList();
    }
    streamListConfig.methods.clearData = function () {
        this.searchObject.shop =this.selectId;
    }


    streamListConfig.computed = {};

    streamListConfig.data = function () {
        return {
            searchObject: {
                no: 1,
                size: 10,
            },
            dialogVisible: false,
            auditVisible: false,
            defaultProps: {
                children: 'children',
                label: 'name'
            },
            loading: false,
            tableData: {},
            activeIndex: "1",
            form: {
                logo: '',
                name: '',
                streamCatalog: '',
                sortNum: '',
                boss: '',
                address: '',
                tel: '',
                auditState:""
            },
            rules: {
                name: [
                    { required: true, message: '请输入商家名称', trigger: 'blur' }
                ],
            }
        }
    };
    streamListConfig.methods.showAddView = function () {
        this.$router.push({ path: 'add' });
    };
    streamListConfig.mounted = function () {
        var id = this.$route.query.id;
        this.selectId = id;
        this.searchObject.shop =this.selectId;
        this.getSearchList();
    }
    var streamListView = Vue.component('list-stream-view', streamListConfig);
</script>
[/#macro]